package fr.fermeManager.application.utils;

import fr.fermeManager.application.controllers.MenuController;
import fr.fermeManager.application.frames.MainFrame;
import fr.fermeManager.application.views.BasePanel;

/**
 * This class provides application-wide access to the Spring ApplicationContext.
 * The ApplicationContext is injected by the class "ApplicationContextProvider".
 *
 * @author Siegfried Bolz
 */
public class AppContext {
	
    private static SessionManager session = new SessionManager();
    
    private static MenuController menuController;
    
    private static MainFrame mainFrame;
    
	/**
	 * @return the session
	 */
	public static SessionManager getSession() {
		return session;
	}
	
	public static void setBasePanel(BasePanel basePanelParam,boolean pack){
		mainFrame.setBasePanel(basePanelParam,pack);
		
	}
	
	public static BasePanel getBasePanel(){
		return mainFrame.getBasePanel();
	}

	/**
	 * @return the menuController
	 */
	public static MenuController getMenuController() {
		return menuController;
	}

	/**
	 * @param menuController the menuController to set
	 */
	public static void setMenuController(MenuController menuController) {
		AppContext.menuController = menuController;
	}

	/**
	 * @param mainFrame the mainFrame to set
	 */
	public static void setMainFrame(MainFrame mainFrame) {
		AppContext.mainFrame = mainFrame;
	}

	/**
	 * @return the mainFrame
	 */
	public static MainFrame getMainFrame() {
		return mainFrame;
	}

	public static void setStatutTitre(String string) {
		mainFrame.setStatutMessage(string);
	}
}